<template>
	<view class="content">
		<view class="label">
			请选择投资类型
		</view>
		<view class="u-page__item" @click="goPage('/pages/project/investment/invest?pid=',pid)">
			<uni-row class="demo-uni-row">
				<uni-col :span='6'>
					<view class="demo-layout bg-purple">
						<image src="../../static/icon/guquan.png" mode=""></image>
					</view>
				</uni-col>
				<uni-col :span='16'>
					<view class="demo-layout bg-purple-light">
						<view class="title">成为股东或投资人</view>
						<view class="titleinfo">成为股东，享受股权收益</view>
					</view>
				</uni-col>
				<uni-col :span='1'>
					<view class="demo-layout bg-purple-dark">
						<image src="../../static/icon/cellmore.png" mode=""></image>
					</view>
				</uni-col>
			</uni-row>
		</view>
		<view class="u-page__item" @click="goPage('/pages/project/investment/family?pid=',pid)">
			<uni-row class="demo-uni-row">
				<uni-col :span='6'>
					<view class="demo-layout bg-purple">
						<image src="../../static/icon/vip.png" mode=""></image>
					</view>
				</uni-col>
				<uni-col :span='16'>
					<view class="demo-layout bg-purple-light">
						<view class="title">成为家人</view>
						<view class="titleinfo">成为家人，享受优惠权益</view>
					</view>
				</uni-col>
				<uni-col :span='1'>
					<view class="demo-layout bg-purple-dark">
						<image src="../../static/icon/cellmore.png" mode=""></image>
					</view>
				</uni-col>
			</uni-row>
		</view>
		<view class="popup" v-if="userData.phoneAttestation !=1">
		<view class="popmessage">
			<view class="title">提示</view>
			<view class="info">首次投资项目需要进行实名认证</view>
			<view class="security">我们将会对用户的实名认证信息进行安全加密</view>
			<view class="button">
				<button type="default" size="mini" @click="goPage('/pages/project/index?id=',pid)">取消</button>
				<button type="warn" size="mini"
					@click="goPage('/pages/project/investment/authentication?pid=',pid)">去认证</button>
				<!-- <button type="warn" size="mini"  @click="goPage('/pages/project/investment/idcardsuccessful?pid=',pid)">去认证</button> -->
			</view>
		</view>
	</view>
	</view>
	
	<!-- <authorize v-if="userinfo"></authorize> -->

</template>

<script>
	import authorize from "@/components/authorize.vue"
	// import JSAPIV3 from "@/lib/wxPay/wxPay.js"

	export default {
		components: {
			authorize
		},
		data() {
			return {
				 pid:'',
				 show:true,
				 userinfo:false,
				 popup:"display:inline",
				 userData:'',
				 familyname:"家人"
			}
		},
		onLoad(e) {
			this.pid = e.pid
			//获取用户信息
			let user = uni.getStorageSync('userData');
			// console.log('1111----',user)
			if (!uni.getStorageSync('userData')) {
				this.userinfo = true
			}
			this.userData = user;
			this.userInfo()
		},
		methods: {
			//获取用户信息
			async userInfo() {
				const user = await this.GQL({
					"operationName": "allSlUsers",
					"query": "query allSlUsers($filter: SlUserFilter) { allSlUsers(filter:$filter) { nodes { phoneAttestation idAttestation phone openid nickname level jurisdiction isStore uid status storeBalance balance avatarUrl phoneLssue } } }",
					"variables": {
						"filter": {
							"uid": {
								"equalTo": this.userData.uid
							}
						}
					}
				})
				const siteName = await this.GQL({
					"operationName": "allSlSystemConfigs",
					"query": "query allSlSystemConfigs($filter: SlSystemConfigFilter) { allSlSystemConfigs(filter: $filter) { nodes { id  menuName familyname} } }",
					"variables": {"filter": {"menuName": {"equalTo": "site_name"}}}
				})
				if(siteName.data.allSlSystemConfigs.nodes !=''){
					this.familyname = siteName.data.allSlSystemConfigs.nodes[0].familyname
				}
				// console.log('1111',user)
				this.userData = user.data.allSlUsers.nodes[0]
				console.log('22222222', this.userData)

			},

			goPage(url, pid) {

				uni.navigateTo({
					url: url + pid
				})
			}
		}
	}
</script>

<style lang="scss">
	.label {
		margin: 30px 15px;
		font-size: 18px;
		font-weight: 600;
		color: #161E3E;
		line-height: 16px;
	}

	.u-page__item {
		margin: 15px;
		height: 80px;
		margin-bottom: 15px;
		border-bottom: 0px;
		// border: 0px solid #bbbbbb;
		border-radius: 4rpx;
		background-color: #FFFFFF;

		.bg-purple {
			display: flex;
			align-items: center;
			justify-content: center;
			height: 80px;
		}

		.bg-purple image {
			width: 61px;
			height: 60px;
		}

		.bg-purple-light {
			height: 80px;
		}

		.title {
			padding-top: 18px;
			font-size: 16px;
			color: #161E3E;
			font-weight: 600;
		}

		.titleinfo {
			margin-top: 5px;
			font-size: 12px;
			font-weight: 400;
			color: #9BA7C1;
		}

		.bg-purple-dark {
			display: flex;
			align-items: flex-end;
			height: 65px;

			image {
				width: 20px;
				height: 20px;
			}
		}
	}

	.popup {
		position: absolute;
		top: 0;
		height: 100%;
		background-color: rgba(0, 0, 0, 0.5);
		width: 100%;

		.popmessage {
			position: relative;
			text-align: center;
			top: 25%;
			background: #ffff;
			margin: 20px;
			border-radius: 10px;

			.title {
				font-size: 18px;
				font-family: PingFangSC-Semibold, PingFang SC;
				font-weight: 600;
				color: #161E3E;
				line-height: 16px;
				padding: 15px;
			}

			.info {
				margin: 10px;
				font-size: 14px;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #161E3E;
				line-height: 24px;
			}

			.security {
				font-size: 12px;
				font-family: PingFangSC-Regular, PingFang SC;
				font-weight: 400;
				color: #A1ACC5;
				line-height: 24px;
			}

			.button {
				padding: 20px 0px 10px 0px;

				button {
					margin: 10px;
				}
			}
		}


	}
</style>
